import BaseApi from '../BaseApi';

const controller = "/chargeStandard";
const park = "/park";

export default {

    getChargeStandardTree() {
        return this.requestPost(controller, "/getChargeStandardTree");
    },
    findLandlordTree() {
        return this.requestPost("/landlord", "/listLandlordInfo");
    },
    getChargeStandardList(condition) {
        return this.requestPost(controller, "/getChargeStandardList", condition);
    },

    add(condition) {
        return this.requestPost(controller, "/add", condition);
    },
    del(condition) {
        let id = condition.id;
        return this.requestGet(controller, "/del/" + id);
    },
    update(condition) {
        return this.requestPost(controller, "/update", condition);
    },
    addChargeStandardChild(condition) {
        return this.requestPostForJson(controller, "/addChargeStandardChild", condition);
    },
    delChargeStandardChild(condition) {
        // let id = condition.id;
        // return this.requestGet(controller, "/delChargeStandardChild/" + id);
        return this.requestPost(controller, "/delChargeStandardChild/", condition);
    },
    point() {
        return this.requestGet(park, "/parkTree")
    },
    pointTree() {
        return this.requestGet(park, "/parkTreeImei")
    },

    pointName() {
        return this.requestGet(park, "/parkFilter")
    },

    queryHoliday({ year }) {
        return this.requestPost('/holiday', '/queryHoliday', { year });
    },

    updateHoliday(data) {
        return this.requestPostForJson('/holiday', '/updateHoliday', data);
    },
    // 获取月卡停车点
    getMonthCardPark(data) {
        return this.requestPost('/marketing', '/getMonthCardPark', data);
    },
    // 获取月卡泊位
    getMonthCardParkTruck(data) {
        return this.requestPost('/marketing', '/getMonthCardParkTruck', data);
    },
    // 删除月卡配置
    deleteMonthCardLink(data) {
        return this.requestPost('/marketing', '/deleteMonthCardLink', data);
    },

    /*请求封装*/
    requestPost(controller, url, condition) {
        let newUrl = controller + url;
        return BaseApi.requestPost(newUrl, condition);

    },
    requestPostForJson(controller, url, condition) {
        let newUrl = controller + url;
        return BaseApi.requestPostForJson(newUrl, condition);
    },


    requestGet(controller, url, condition) {
        let newUrl = controller + url;
        return BaseApi.requestGet(newUrl, condition);
    },


}